<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSkusTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('skus', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('goods_id')->comment('[v1.0]Sku所属商品id');
            $table->string('name')->nullable()->comment('[v1.0]商品名称');
            $table->string('sn', 60)->nullable()->index('skus_sn')->comment('[v1.0]商品单品的唯一货号');
            $table->json('attrabutes')->nullable()->comment('[v1.0]sku 商品的具体属性');

            // 收费信息
		    $table->integer('price')->nullable()->comment('[v1.0]商品售价，单位分。');
            $table->integer('market_price')->nullable()->comment('[v1.0]市场售价');

            // 附加信息
		    $table->string('specification')->nullable()->comment('[v1.0]规格');
            $table->integer('weight')->unsigned()->nullable()->comment('商品的重量，以克为单位。');
            $table->string('thumb')->nullable()->comment('[v1.0]商品的微缩图片');
            
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('skus');
    }
}
